package com.audi.box.service;

import java.util.ArrayList;

import com.audi.box.adapter.SQLiteAsusHelperScene;
import com.audi.dto.SceneDeviceItem;
import com.audi.dto.SceneItem;

public class SceneServiceImp implements SceneService {
    
    private SQLiteAsusHelperScene mSQLHelper;
    
    public SceneServiceImp(SQLiteAsusHelperScene mSQLHelper) throws Exception {
        this.mSQLHelper = mSQLHelper;
    }
    
    public void setSQLiteHelper(SQLiteAsusHelperScene mSQLHelper) {
        this.mSQLHelper = mSQLHelper;
    }
    
    @Override
    public int addScene(SceneItem scene) {
        return mSQLHelper.addScene(scene);
    }
    
    @Override
    public int updateScene(SceneItem scene) {
        return mSQLHelper.updateScene(scene);
    }
    
    @Override
    public int renameScene(SceneItem scene) {
        return updateScene(scene);
    }
    
    @Override
    public int deleteScene(SceneItem scene) {
        return mSQLHelper.deleteSceneById(scene);
    }
    
    @Override
    public boolean isExist(SceneItem scene) {
        // need check scene is exist method in mSQLHelper Class
        // pubic boolean isExistScene(KEY_DEVICE_CODE)
        return mSQLHelper.checkExistScene(scene);
    }
    
    @Override
    public ArrayList<SceneItem> getListScene() {
        return mSQLHelper.getListScene();
    }
    
    @Override
    public ArrayList<SceneItem> getListScene(int placeId) {
        return mSQLHelper.getSceneByPlaceId(placeId);
    }
    
    @Override
    public SceneItem getScene(int sceneId) {
        return mSQLHelper.getSceneById(sceneId);
    }
    
    @Override
    public int addSceneDevice(SceneDeviceItem sceneDevice) {
        return mSQLHelper.addSceneDevice(sceneDevice);
    }
    
    @Override
    public ArrayList<SceneDeviceItem> getListSceneDevice() {
        return mSQLHelper.getSceneDeviceList();
    }
    
    @Override
    public SceneDeviceItem getSceneDevice(int sceneId, int deviceId) {
        return mSQLHelper.getSceneDevice(sceneId, deviceId);
    }
    
    @Override
    public int deleteSceneDeviceItem(SceneDeviceItem sceneDevice) {
        return mSQLHelper.deleteSceneDeviceItem(sceneDevice);
    }
}
